/* SPDX-License-Identifier: GPL-2.0 OR Apache 2.0
 *
 * Copyright (c) 2024 Black Sesame Technologies
 *
 * This program is also distributed under the terms of the Apache 2.0
 * License.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/* This file is auto generated for message box v1.1.0.
 * All manual modifications will be LOST by next generation.
 * It is recommended NOT modify it.
 * Generator Version: francaidl c4b9707 msgbx_ipc 1964fef
 */

#ifndef SWITCH0_CAN_GATEWAY_SERVER_H
#define SWITCH0_CAN_GATEWAY_SERVER_H

#define IPC_RTE_BAREMETAL
#ifdef IPC_RTE_KERNEL
#include <bst/ipc_app_svr_utils.h>
#else
#include "ipc_app_svr_utils.h"
#endif
#include "switch0_can_gateway_datatype.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Stub function for method notify_Eth_2_Can_enqueue.
 *
 * @param element_ptr The input argument of method notify_Eth_2_Can_enqueue.
 * @param element_count The input argument of method notify_Eth_2_Can_enqueue.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_notify_Eth_2_Can_enqueue_t)(
				const uint32_t element_ptr,
				const uint16_t element_count,
				const ext_info_t *info
				);
/**
 * Stub function for method notify_Eth_2_Can_dequeue.
 *
 * @param element_ptr The input argument of method notify_Eth_2_Can_dequeue.
 * @param element_count The input argument of method notify_Eth_2_Can_dequeue.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_notify_Eth_2_Can_dequeue_t)(
				const uint32_t element_ptr,
				const uint16_t element_count,
				const ext_info_t *info
				);
/**
 * Stub function for method notify_Can_2_Eth_enqueue.
 *
 * @param element_ptr The input argument of method notify_Can_2_Eth_enqueue.
 * @param element_count The input argument of method notify_Can_2_Eth_enqueue.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_notify_Can_2_Eth_enqueue_t)(
				const uint32_t element_ptr,
				const uint16_t element_count,
				const ext_info_t *info
				);
/**
 * Stub function for method notify_Can_2_Eth_dequeue.
 *
 * @param element_ptr The input argument of method notify_Can_2_Eth_dequeue.
 * @param element_count The input argument of method notify_Can_2_Eth_dequeue.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_notify_Can_2_Eth_dequeue_t)(
				const uint32_t element_ptr,
				const uint16_t element_count,
				const ext_info_t *info
				);
/**
 * Stub function for method get_ETH_statistics.
 *
 * @param context The message context, to be passed to the reply function.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_get_ETH_statistics_t)(
				const uint64_t context,
				const ext_info_t *info
				);
/**
 * Stub function for method vmac_method.
 *
 * @param vmac_msg The input argument of method vmac_method.
 * @param flag The input argument of method vmac_method.
 * @param context The message context, to be passed to the reply function.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_vmac_method_t)(
				const switch0_can_gateway_MyArray_t vmac_msg,
				const uint32_t flag,
				const uint64_t context,
				const ext_info_t *info
				);
/**
 * Stub function for method vcan_method.
 *
 * @param command The input argument of method vcan_method.
 * @param param The input argument of method vcan_method.
 * @param context The message context, to be passed to the reply function.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_vcan_method_t)(
				const uint8_t command,
				const uint32_t param,
				const uint64_t context,
				const ext_info_t *info
				);
/**
 * Stub function for method can_gateway_send.
 *
 * @param x2can The input argument of method can_gateway_send.
 * @param context The message context, to be passed to the reply function.
 * @param info The extended information, containing uuid and timestamp.
 */
typedef void (*switch0_can_gateway_can_gateway_send_t)(
				const switch0_can_gateway_UInt8Array128_t *x2can,
				const uint64_t context,
				const ext_info_t *info
				);

// Interface server
struct _switch0_can_gateway_server_t {
	/**
	 * Get the version of the interface.
	 *
	 * @return The version struct, containing major and minor.
	 */
	ipc_inf_version_t (*version)(void);

	/**
	 * Register stub function for method notify_Eth_2_Can_enqueue.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_notify_Eth_2_Can_enqueue)(switch0_can_gateway_notify_Eth_2_Can_enqueue_t func);

	/**
	 * Register stub function for method notify_Eth_2_Can_dequeue.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_notify_Eth_2_Can_dequeue)(switch0_can_gateway_notify_Eth_2_Can_dequeue_t func);

	/**
	 * Register stub function for method notify_Can_2_Eth_enqueue.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_notify_Can_2_Eth_enqueue)(switch0_can_gateway_notify_Can_2_Eth_enqueue_t func);

	/**
	 * Register stub function for method notify_Can_2_Eth_dequeue.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_notify_Can_2_Eth_dequeue)(switch0_can_gateway_notify_Can_2_Eth_dequeue_t func);

	/**
	 * Register stub function for method get_ETH_statistics.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_get_ETH_statistics)(switch0_can_gateway_get_ETH_statistics_t func);

	/**
	 * Send the reply message of method get_ETH_statistics.
	 *
	 * @param statistics_data_ptr The output argument of method get_ETH_statistics.
	 * @param err The error code returned to the client.
	 * @param context The message context, got from the method stub function.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*reply_get_ETH_statistics)(
					const uint32_t statistics_data_ptr,
					const switch0_can_gateway_ErrorEnum_t err,
					const uint64_t context);

	/**
	 * Register stub function for method vmac_method.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_vmac_method)(switch0_can_gateway_vmac_method_t func);

	/**
	 * Send the reply message of method vmac_method.
	 *
	 * @param err The error code returned to the client.
	 * @param context The message context, got from the method stub function.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*reply_vmac_method)(
					const switch0_can_gateway_ErrorEnum_t err,
					const uint64_t context);

	/**
	 * Register stub function for method vcan_method.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_vcan_method)(switch0_can_gateway_vcan_method_t func);

	/**
	 * Send the reply message of method vcan_method.
	 *
	 * @param err The error code returned to the client.
	 * @param context The message context, got from the method stub function.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*reply_vcan_method)(
					const switch0_can_gateway_ErrorEnum_t err,
					const uint64_t context);

	/**
	 * Register stub function for method can_gateway_send.
	 *
	 * @param func The stub function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_can_gateway_send)(switch0_can_gateway_can_gateway_send_t func);

	/**
	 * Send the reply message of method can_gateway_send.
	 *
	 * @param err The error code returned to the client.
	 * @param context The message context, got from the method stub function.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*reply_can_gateway_send)(
					const switch0_can_gateway_ErrorEnum_t err,
					const uint64_t context);

	/**
	 * Send broadcast can_gateway_recv to all subscribers.
	 *
	 * @param entries The selected entries to broadcast.
	 * @param size The size of the entries.
	 */
	int32_t (*can_gateway_recv)(broadcast_reg_entry_t *entries, uint32_t size);

	/**
	 * Register subscribed callback function for broadcast can_gateway_recv
	 *
	 * @param func The callback function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_can_gateway_recv_subcribed)(broadcast_sub_t func);

	/**
	 * Register unsubscribed callback function for broadcast can_gateway_recv
	 *
	 * @param func The callback function to be registered.
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*register_can_gateway_recv_unsubcribed)(broadcast_sub_t func);

	/**
	 * Dispatch server messages.
	 *
	 * @return 0 if success, negative if fail.
	 */
	int32_t (*dispatch_request)(serdes_t *des, bool *reply);
};
#define switch0_can_gateway_server_t struct _switch0_can_gateway_server_t

/**
 *  The extend data used by the server.
 */
struct _switch0_can_gateway_server_ext_t {
	switch0_can_gateway_notify_Eth_2_Can_enqueue_t notify_Eth_2_Can_enqueue_ptr;
	switch0_can_gateway_notify_Eth_2_Can_dequeue_t notify_Eth_2_Can_dequeue_ptr;
	switch0_can_gateway_notify_Can_2_Eth_enqueue_t notify_Can_2_Eth_enqueue_ptr;
	switch0_can_gateway_notify_Can_2_Eth_dequeue_t notify_Can_2_Eth_dequeue_ptr;
	switch0_can_gateway_get_ETH_statistics_t get_ETH_statistics_ptr;
	switch0_can_gateway_vmac_method_t vmac_method_ptr;
	switch0_can_gateway_vcan_method_t vcan_method_ptr;
	switch0_can_gateway_can_gateway_send_t can_gateway_send_ptr;
	broadcast_sub_t can_gateway_recv_sub_ptr;
	broadcast_sub_t can_gateway_recv_unsub_ptr;
	broadcast_registry_t can_gateway_recv_registry;
};
#define switch0_can_gateway_server_ext_t struct _switch0_can_gateway_server_ext_t

/**
 * Initializes the server.
 *
 * @param data The data for com_server_data_t
 * @param server The data for test_server_t
 * @param ext The data for test_server_ext_t
 * @return 0 if success, negative if fail.
 */
int32_t switch0_can_gateway_server_init(com_server_data_t *data,
			switch0_can_gateway_server_t *server,
			switch0_can_gateway_server_ext_t *ext);

/**
 * Destroys the test client.
 */
void switch0_can_gateway_server_destroy(void);

#ifdef __cplusplus
}
#endif

#endif // SWITCH0_CAN_GATEWAY_SERVER_H
